﻿using System;
using System.IO;

namespace ForthClassAssignment{
    public class Loader{
        private Loader(){}

        public static FileInfo[] LoadFile(string path){
            //访问不成功说明没有访问权限
            try {
                var root = new DirectoryInfo(path);
                var files = root.GetFiles();
                return files;
            }
            catch (Exception) {
                return Array.Empty<FileInfo>();
            }
            
        }

        public static DirectoryInfo[] LoadDirectory(string path){
            try {
                var root = new DirectoryInfo(path);
                var directories = root.GetDirectories();
                return directories;
            }
            catch(Exception) {
                return Array.Empty<DirectoryInfo>();
            }
        }
    }
}